package descentFly.away3D4.controller
{
	import descentFly.away3D4.action.df_action;
	import descentFly.away3D4.chips.df_chipModel;
	import descentFly.chips.df_chip;
	import descentFly.controller.df_robotController;
	import descentFly.df_space;
	
	import flash.display.Stage;
	
	public class df_robot extends df_robotAway {
		public static function create(a_stage	: Stage,
									  a_space	: df_space,
									  a_options: Object=null): df_robotController {
			return new df_robot(a_stage, a_space, a_options);
		}
		
		public function df_robot(a_stage:Stage, a_space:df_space, a_options: Object=null) {
			super(a_stage, a_space, a_options);
		}
		
		override public function setBody(a_body:df_chip):void {
			super.setBody(a_body);
			state = df_robotController.STATE_PATROL;
		}
		
		override protected function doChangeSee():void {
			super.doChangeSee();
			
			if (body is df_chipModel) {
				if (see) (body as df_chipModel).beginAction(df_chipModel.WEAPONT_ACTIVATE_NAME);
				else (body as df_chipModel).beginAction(df_chipModel.WEAPONT_ACTIVATE_NAME, df_action.SP_INVERSE);
			}

			if (see) state = df_robotController.STATE_ATACK;
			else state = df_robotController.STATE_PATROL;
			
		}
	}
}